$(function(){
	index.init();
});
var index={
	init:function(){
		$('._td').click(index.activity);
		$('._pointtd').click(index.pointdetail);
		$('._appdetail').click(index.appdetail);
		$('#_pointmall').click(index.pointmall);
		$('#_shake').click(index.shake);
		$('#_download').click(index.download);
		$('._categorytd').click(index.appCategory);
		$('#_exchange').click(index.exchange);
		$('#_exchangerecord').click(index.exchangerecord);
		$('#return_idx').click(index.return_idx);
		$('#return_point').click(index.return_point);
		$('#return_shake').click(index.return_shake);
		$("#hot_news").click(index.hot_news)
	},
	activity:function(){
		var id = $(this).attr('id');
		var adIdeaId = id.split('_')[0];
		var adPositionId = id.split('_')[1];
		$('#adIdeaId').val(adIdeaId);
		$('#adPositionId').val(adPositionId);
		$('#_form').attr('action',ctx +'/_ad/activity');
		$('#_form').submit();
	},
	pointmall:function(){
		$('#adPositionId').val("http://h5.glela.com/new/westore.htm?talentid=1261");
		$('#_form').attr('action',ctx +'/_ad/outlink');
		$('#_form').submit();
		//$('#_form').attr('action',ctx +'/_ad/point');
		//$('#_form').submit();
	},
	exchangerecord:function(){
		$('#_form').attr('action',ctx +'/_ad/exchangerecord');
		$('#_form').submit();
	},
	return_idx:function(){
		$('#_form').attr('action',ctx +'/_ad');
		$('#_form').submit();
	},
	return_point:function(){
		$('#_form').attr('action',ctx +'/_ad/point');
		$('#_form').submit();
	},
	return_shake:function(){
		$('#_form').attr('action',ctx +'/_ad/shake');
		$('#_form').submit();
	},
	shake:function(){
		$('#_form').attr('action',ctx +'/_ad/shake');
		$('#_form').submit();
	},
	appCategory:function(){
		var id = $(this).attr('id');
		//白拿白送
		if(id==1){
			//$('#adPositionId').val("http://localhost/_ad/bainabaisong");
			$('#_form').attr('action',ctx +'/_ad/bainabaisong');
			$('#_form').submit();
			return true;
		}
		//话费充值
		if(id==8){
			$('#adPositionId').val("http://m.putao.cn/huafei_pt/huafei.html");
			$('#_form').attr('action',ctx +'/_ad/outlink');
			$('#_form').submit();
			return true;
		}
		//电影抢座
		if(id==9){
			$('#adPositionId').val("http://m.putao.cn/movie_pt/movie/movie-list.html");
			$('#_form').attr('action',ctx +'/_ad/outlink');
			$('#_form').submit();
			return true;
		}
		//积分商城
		if(id==6){
			$('#_form').attr('action',ctx +'/_ad/point');
			$('#_form').submit();
			return true;
		}
		//金融保险，暂时没有链接
		if(id==10)
			return ture;
		$('#appCategoryId').val(id);
		$('#_form').attr('action',ctx +'/_ad/app');
		$('#_form').submit();
	},
	appdetail:function(){
		var id = $(this).attr('id');
		var adIdeaId = id.split('_')[0];
		var adPositionId = id.split('_')[1];
		var myAppId = id.split('_')[2];
		$('#adIdeaId').val(adIdeaId);
		$('#adPositionId').val(adPositionId);
		$('#myAppId').val(myAppId);
		$('#_form').attr('action',ctx +'/_ad/appdetail');
		$('#_form').submit();
	},
	download:function(){
		$('#_form').attr('action',ctx +'/_ad/download');
		$('#_form').submit();
	},
	pointdetail:function(){
		var id = $(this).attr('id');
		var adIdeaId = id.split('_')[0];
		var adPositionId = id.split('_')[1];
		$('#adIdeaId').val(adIdeaId);
		$('#adPositionId').val(adPositionId);
		$('#_form').attr('action',ctx +'/_ad/pointdetail');
		$('#_form').submit();
	},
	exchange:function(){
		var muId = $('#mu').val();
		if(muId == ''){
			$('#loginWindow').css('display','block');
			return ;
		}
		$('#_form').attr('action',ctx +'/_ad/exchange');
		$('#_form').submit();
	},
	hot_news:function(){
		location.href=ctx+"/news/hotnews";
	}
	
};

